{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'tensorflow'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-1-36e38c7998ed>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mtensorflow\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      2\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpyplot\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_line_magic\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'matplotlib'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'inline'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'tensorflow'"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### Data simulation\n",
    "y = 1*x + 0 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "x_data = np.linspace(0,10,20) + np.random.uniform(-1.5,1.5,20)\n",
    "y_data = np.linspace(0,10,20) + np.random.uniform(-1.5,1.5,20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x11afec6a0>]"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAECNJREFUeJzt3X+MXWWdx/HPZzp1hh9FMEyRtrTDbkoV2bW4N4A22VjA\nCAuhmE0afoZsTPqHC6Ixgbqw4Z/uxj+MkUazaYMoyUDJpmIkShWoGrsJGZhSslLGbgniUGyd25C1\ndJMZGOa7f9w7Mg5tZ+49595z73Per4T0ntMz53wPtB+e+5zneY4jQgCA7tdTdAEAgHwQ6ACQCAId\nABJBoANAIgh0AEgEgQ4AiSDQASARBDoAJIJAB4BE9LbzYueee24MDg6285IA0PX27t17NCIG5juu\nrYE+ODiokZGRdl4SALqe7d8v5Di6XAAgEQQ6ACRi3kC3/bDtcdsvz9r3EdvP2D5Y//Wc1pYJAJjP\nQlroP5B0zZx9myXtjojVknbXtwEABZo30CPi15LemrN7g6RH6p8fkXRjznUBABrUbB/6eRFxuP75\niKTzcqoHAJIzfmxCG7c9p/G3J1p6ncwPRaP2yqOTvvbI9ibbI7ZHqtVq1ssBQNfZuvugXnj9LW19\n9mBLr9PsOPQ/2j4/Ig7bPl/S+MkOjIjtkrZLUq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mkVyPitYh4R9LjkjYUXFPL\nRcThiHix/vlt1f5yLy+2qvawvULSdZIeKrqWdrH9YUl/L+l7khQR70TE/xZbVdv0SjrNdq+k0yX9\noeB6WiIifi3prTm7N0h6pP75EUk3NnPubgr05ZLemLV9SCUJthm2ByVdKmm42Era5tuS7pE0Pd+B\nCblQUlXS9+tdTQ/ZPqPoolotIt6U9E1JY5IOS/pTRDxdbFVtdV5EHK5/PiLpvGZO0k2BXmq2z5T0\nQ0lfiYhjRdfTaravlzQeEXuLrqXNeiV9StJ/RMSlkv5PTX797ib1PuMNqv0PbZmkM2zfVmxVxYja\n0MOmhh92U6C/KemCWdsr6vuSZ3uxamH+aEQ8UXQ9bbJO0g22X1ete+1K20PFltQWhyQdioiZb2E7\nVQv41F0t6XcRUY2IdyU9IekzBdfUTn+0fb4k1X8db+Yk3RToL0habftC2x9S7YHJkwXX1HK2rVp/\n6mhEfKvoetolIr4eESsiYlC1/9a/iIjkW2wRcUTSG7bX1HddJemVAktqlzFJV9g+vf5n/iqV4GHw\nLE9KuqP++Q5JP27mJL25ldNiETFl+05JP1ftCfjDEbG/4LLaYZ2k2yX9xvZL9X3/EhFPFVgTWusu\nSY/WGy6vSfqngutpuYgYtr1T0ouqjezap0RnjdreIemzks61fUjSA5K+Iek/bX9RtRVpNzZ1bmaK\nAkAauqnLBQBwCgQ6ACSCQAeARBDoAJAIAh0AEkGgA0AiCHQASASBDgCJ+H9DF4FVKa2o8AAAAABJ\nRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x107d56828>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(x_data, y_data, '*')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Initiallize w and b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "w = np.random.uniform(-1,1)\n",
    "b = np.random.uniform(-1,1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-0.6958270288165385 -0.9809061207878003\n"
     ]
    }
   ],
   "source": [
    "print(w,b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "w_tf = tf.Variable(w)\n",
    "b_tf = tf.Variable(b)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Define error"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [],
   "source": [
    "error = 0\n",
    "for x,y in zip(x_data,y_data):\n",
    "    error += (w_tf * x + b_tf - y)**2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Optimizer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [],
   "source": [
    "optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.001)\n",
    "train = optimizer.minimize(error)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "init = tf.global_variables_initializer()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_steps = 10\n",
    "with tf.Session() as sess:\n",
    "    sess.run(init)\n",
    "    for step in range(train_steps):\n",
    "        sess.run(train)\n",
    "    w_final, b_final = sess.run([w_tf,b_tf])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "y_pred = w_final * x_data + b_final"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x11d7c3d30>]"
      ]
     },
     "execution_count": 101,
     "metadata": {},
     "output_type": "execute_result"
    },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1e9riVezKyBmb1oZsvNbJmZ/cjrmuLBzG4o/zP+mZk9\nb2bZXtcUC2Y2xcwKzeyzCn2NzOxtM1tR/mPDcM6dNIFuZunAROBCoC1wpZm19baquCgDbnTOtQW6\nAINS5HPvMxRY5nURcfYw8IZz7kTgVFLg85vZ0cAQIM851w5IB67wtqqYeRrosV/fKGC2c+54YHZ5\nu9aSJtCBTsBK59xq59we4B9Ab49rijnn3Ebn3OLyr3cS/Mt9tLdVxYeZtQR6Ak94XUu8mNmRwE+A\nJwGcc3ucc9u8rSpuMoA6ZpYB1AW+8riemHDOvQ9s2a+7N/BM+dfPAJeEc+5kCvSjgXUV2utJkWDb\nx8xygY7APG8riZuHgBFAwOtC4qg1UAQ8VT7V9ISZHe51UbHmnNsA/AUoADYC251zqfTeyWbOuY3l\nX28CmoVzkmQK9JRmZkcA04FhzrkdXtcTa2Z2MVDonFvkdS1xlgGcBvzVOdcR+JYw//mdTMrnjHsT\n/B9aC+BwMxvgbVXecMFHD8N6/DCZAn0DcEyFdsvyPt8zs0yCYT7NOfeS1/XESVegl5mtJTi99lMz\nm+ptSXGxHljvnNv3r7AXCQa8350LrHHOFTnnSoGXgDM9rimevjazowDKfywM5yTJFOgLgOPNrLWZ\nHUbwhslMj2uKOTMzgvOpy5xzD3hdT7w4525yzrV0zuUS/L1+xznn+xGbc24TsM7M2pR3dQc+97Ck\neCkAuphZ3fI/891JgZvBFcwEri7/+mpgRjgnyYhaOTHmnCszs8HAmwTvgE9xzi31uKx46ApcBXxq\nZh+X993snMv3sCaJreuBaeUDl9XAtR7XE3POuXlm9iKwmOCTXUvw6apRM3seOAdobGbrgTHAvcAL\nZvZrgjvSXhbWubVSVETEH5JpykVERA5BgS4i4hMKdBERn1Cgi4j4hAJdRMQnFOgiIj6hQBcR8QkF\nuoiIT/w/fopJmEq5XMIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11d7c3d68>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(x_data, y_data, '*')\n",
    "plt.plot(x_data, y_pred)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
